package ahblue.cn.tanzi.model.user;

import android.content.Context;
import android.widget.Toast;

import java.util.List;

import ahblue.cn.tanzi.data.source.ApiCallback;
import ahblue.cn.tanzi.data.source.RemoteRepository;

/**
 * Created by fengdongfei on 2018/12/1.
 */

public class LookHisToryModel {


    /**
     * day : 2018-12-06
     * data : [{"object_name":"文章","title":"测试","image":"http://img-app.qqsuu.top/20181123%5Cd5140b531d82e63ebf7d6d1098891704.jpg","day":"2018-12-06","hour":"22:34"}]
     */

    public String day;
    public List<DataModel> data;

    public static class DataModel {
        /**
         * object_name : 文章
         * title : 测试
         * image : http://img-app.qqsuu.top/20181123%5Cd5140b531d82e63ebf7d6d1098891704.jpg
         * day : 2018-12-06
         * hour : 22:34
         */

        public String object_name;
        public String title;
        public String image;
        public String day;
        public String hour;
    }

    public static void getLooked(final Context context ,
                                 String token,
                                 final VertifyListener loginListener){
        RemoteRepository repo = RemoteRepository.getsInstance();
        repo.getLook(token, new ApiCallback<List<LookHisToryModel> >(){
            @Override
            public void onSuccess(List<LookHisToryModel>  data) {
                if (null!=loginListener){
                    loginListener.conver(data);
                }
            }

            @Override
            public void onFailed(String errorMsg) {
                Toast.makeText(context,errorMsg,Toast.LENGTH_LONG).show();
                if (null!=loginListener){
                    loginListener.conver(null);
                }
            }
        });
    }


   public interface VertifyListener{
        void conver(List<LookHisToryModel> list);
   }


}
